/*   1:    */ package com.rinsi.app.azsb.azzl.scs.scb;
/*   2:    */ 
/*   3:    */ import com.rinsi.core.contoller.CoreSimpleController;
/*   4:    */ import com.rinsi.core.service.CoreSimpleService;
/*   5:    */ import com.rinsi.util.FileUtil;
/*   6:    */ import com.rinsi.util.MapUtil;
/*   7:    */ import com.rinsi.util.SpringContextUtil;
/*   8:    */ import java.io.PrintWriter;
/*   9:    */ import java.util.List;
/*  10:    */ import java.util.Map;
/*  11:    */ import javax.servlet.http.HttpServletRequest;
/*  12:    */ import javax.servlet.http.HttpServletResponse;
/*  13:    */ import org.springframework.beans.factory.annotation.Autowired;
/*  14:    */ import org.springframework.stereotype.Controller;
/*  15:    */ import org.springframework.ui.ModelMap;
/*  16:    */ import org.springframework.web.bind.annotation.RequestMapping;
/*  17:    */ import org.springframework.web.bind.annotation.RequestParam;
/*  18:    */ import org.springframework.web.bind.annotation.ResponseBody;
/*  19:    */ import org.springframework.web.multipart.MultipartFile;
/*  20:    */ 
/*  21:    */ @Controller
/*  22:    */ @RequestMapping({"/azsb/azzl/scs/scb"})
/*  23:    */ public class ScbController
/*  24:    */   extends CoreSimpleController
/*  25:    */ {
/*  26:    */   @Autowired
/*  27:    */   private ScbService scbService;
/*  28:    */   
/*  29:    */   public CoreSimpleService servce()
/*  30:    */   {
/*  31: 36 */     return this.scbService;
/*  32:    */   }
/*  33:    */   
/*  34:    */   @RequestMapping({"/updateXkzscs"})
/*  35:    */   public Map<String, Object> updateXkzscs(ModelMap model, HttpServletRequest request)
/*  36:    */   {
/*  37: 43 */     model.putAll(this.scbService.updateXkzscs(model));
/*  38:    */     
/*  39: 45 */     return model;
/*  40:    */   }
/*  41:    */   
/*  42:    */   @RequestMapping({"/updateSFSC"})
/*  43:    */   public Map<String, Object> updateSFSC(ModelMap model, HttpServletRequest request)
/*  44:    */   {
/*  45: 51 */     model.putAll(this.scbService.updateSFSC(model));
/*  46:    */     
/*  47: 53 */     return model;
/*  48:    */   }
/*  49:    */   
/*  50:    */   @RequestMapping({"/fileList"})
/*  51:    */   public Map<String, Object> fileList(ModelMap model, HttpServletRequest request)
/*  52:    */   {
/*  53: 60 */     Map<String, Object> rMap = servce().getRMap();
/*  54:    */     try
/*  55:    */     {
/*  56: 64 */       Map<String, Object> params = servce().getParams(model);
/*  57:    */       
/*  58: 66 */       String mod = MapUtil.getString((Map)model.get("module"), "MODULE_NO");
/*  59:    */       
/*  60: 68 */       String filepath = (String)((Map)SpringContextUtil.getBean("config")).get("filepath") + mod + "/";
/*  61:    */       
/*  62: 70 */       String ID = request.getParameter("ID") + "/";
/*  63:    */       
/*  64: 72 */       filepath = filepath + ID;
/*  65:    */       
/*  66: 74 */       List<Map<String, Object>> files = FileUtil.getFileList(filepath);
/*  67:    */       
/*  68: 76 */       params.put("MODULE_NO", mod);
/*  69:    */       
/*  70: 78 */       model.putAll(params);
/*  71:    */       
/*  72: 80 */       model.put("files", files);
/*  73:    */       
/*  74: 82 */       model.put("viewPage", "/app/azsb/azzl/scs/scb/scbFileList.jsp");
/*  75:    */     }
/*  76:    */     catch (Exception e)
/*  77:    */     {
/*  78: 86 */       rMap.put("success", Boolean.valueOf(false));
/*  79:    */       
/*  80: 88 */       rMap.put("message", e.getMessage());
/*  81:    */     }
/*  82: 92 */     return rMap;
/*  83:    */   }
/*  84:    */   
/*  85:    */   @ResponseBody
/*  86:    */   @RequestMapping({"/upload"})
/*  87:    */   public void upload(@RequestParam MultipartFile file, HttpServletRequest request, HttpServletResponse response)
/*  88:    */   {
/*  89:    */     try
/*  90:    */     {
/*  91:101 */       String mod = request.getParameter("MODULE_NO") + "/";
/*  92:    */       
/*  93:103 */       String filepath = (String)((Map)SpringContextUtil.getBean("config")).get("filepath") + mod + "/";
/*  94:    */       
/*  95:105 */       String ID = request.getParameter("ID") + "/";
/*  96:    */       
/*  97:107 */       filepath = filepath + ID;
/*  98:    */       
/*  99:109 */       FileUtil.createFile(filepath, file.getOriginalFilename(), file.getBytes());
/* 100:    */       
/* 101:111 */       response.setCharacterEncoding("UTF-8");
/* 102:    */       
/* 103:113 */       response.getWriter().print(file.getOriginalFilename());
/* 104:    */       
/* 105:115 */       List<Map<String, Object>> files = FileUtil.getFileList(filepath);
/* 106:117 */       if (files.size() == 1)
/* 107:    */       {
/* 108:119 */         Integer sczt = Integer.valueOf(1);
/* 109:    */         
/* 110:121 */         this.scbService.updateSczt(ID.split("/")[0], sczt);
/* 111:    */       }
/* 112:    */     }
/* 113:    */     catch (Exception e)
/* 114:    */     {
/* 115:127 */       e.printStackTrace();
/* 116:    */     }
/* 117:    */   }
/* 118:    */   
/* 119:    */   @ResponseBody
/* 120:    */   @RequestMapping({"/fileRemove"})
/* 121:    */   public Map<String, Object> fileRemove(@RequestParam String filename, HttpServletRequest request, HttpServletResponse response)
/* 122:    */   {
/* 123:134 */     Map<String, Object> rMap = servce().getRMap();
/* 124:    */     try
/* 125:    */     {
/* 126:138 */       String mod = request.getParameter("MODULE_NO") + "/";
/* 127:    */       
/* 128:140 */       String filepath = (String)((Map)SpringContextUtil.getBean("config")).get("filepath") + mod + "/";
/* 129:    */       
/* 130:142 */       String ID = request.getParameter("ID") + "/";
/* 131:    */       
/* 132:144 */       filepath = filepath + ID;
/* 133:    */       
/* 134:146 */       FileUtil.deleteExistedFile(filepath, filename);
/* 135:    */       
/* 136:148 */       List<Map<String, Object>> files = FileUtil.getFileList(filepath);
/* 137:150 */       if (files.size() == 0)
/* 138:    */       {
/* 139:152 */         Integer sczt = Integer.valueOf(0);
/* 140:    */         
/* 141:154 */         this.scbService.updateSczt(ID.split("/")[0], sczt);
/* 142:    */       }
/* 143:    */     }
/* 144:    */     catch (Exception e)
/* 145:    */     {
/* 146:160 */       rMap.put("success", Boolean.valueOf(false));
/* 147:    */       
/* 148:162 */       rMap.put("message", e.getMessage());
/* 149:    */       
/* 150:164 */       e.printStackTrace();
/* 151:    */     }
/* 152:168 */     return rMap;
/* 153:    */   }
/* 154:    */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.app.azsb.azzl.scs.scb.ScbController
 * JD-Core Version:    0.7.0.1
 */